/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/



// 导入弹框
import React from 'react';
import { btnModalProps } from '@/types/soaManage'
// import {
//     Modal,
// } from 'antd';
import ModalWin from '@/components/common/ModalWin';
// import ShButton from '@/components/ShButton';
import style from '@/pages/soaManage/abilitymanagement/index.less'
import { Button } from 'antd';
export default (props: btnModalProps) => {
    const {
        submitModal,
        btnModalShow,
        btnsText = {},
        setBtnModalShow,
        modalWinProps,
        titleModal,
        cDisabled = false,
        children
    } = props
    const { confirm = '确认', cancel = '取消', checkResText = [], content, titleBtn } = btnsText
    return (<>
        <ModalWin
            width={600}
            wrapClassName={style.backModal}
            closable={(titleModal || titleBtn) ? true : false}
            title={(titleModal || titleBtn)}
            key={'checkShow'}
            visible={btnModalShow}
            destroyOnClose={true}
            onCancel={
                () => setBtnModalShow(false)
            }
            footer={[
                cancel ? <Button key="3"
                    size='small'
                    onClick={() => {
                        setBtnModalShow(false);
                    }}>{cancel}</Button> : null,
                <Button key="4"
                    type="primary"
                    size='small'
                    disabled={cDisabled}
                    onClick={() => {
                        submitModal({});
                    }}>{confirm}</Button>
            ]}
            {
            ...modalWinProps
            }
        >
            {
                (children || content) ? (children || content) : checkResText.map((item: string, index: number) => <div key={index}>{item}</div>)
            }
        </ModalWin>
    </>)
}